package com.jdk.learn.juc2.thread;

/**
 * 类功能描述:
 * 父子线程问题
 *
 * @author bgt
 * @version V1.0
 * @since 2019-02-01 10:38
 */
public class InheritableThreadLocalDemo {
    /*
    *   main get :main value
        one get:main value
    * */
    static InheritableThreadLocal<String> threadLocal = new InheritableThreadLocal<>();
    /*
    *   main get :main value
        one get: null
    * */
//    static ThreadLocal<String> threadLocal=new ThreadLocal<>();

    public static void main(String[] args) {
        threadLocal.set("main value ");
        Thread one = new Thread(() -> {
            System.out.println("one get:" + threadLocal.get());
        });
        one.start();
        System.out.println("main get :" + threadLocal.get());
    }
}
